{%include file="header.html"%}
<style>
td {font-weight: bold;}
.firtd {	width: 100px;	padding-right: 10px;	text-align: right;}
input {	width: 350px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>编辑文章分类</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="news_type.php" id="aspnetForm" name="form1" enctype="multipart/form-data">
  	<input type="hidden" name="ad_id" id="ad_id" value="{%$list.ad_id%}" />
    <table style=" width:100%;" cellpadding="0" cellspacing="0" class="table tb-type2">
      <tbody>
        <tr>
          <td class="firtd"> 文章分类名称:</td>
          <td><input type="text" name="cat_name" required value="{%$edit.cat_name%}"> *</td> 
        </tr>
        <tr>
          <td class="firtd"> 上级分类:</td>
          <td>
              <select name="parent_id"  onchange="get_news_type(this,this.value)" id="">
                  <option value="0" id="option">==顶级==</option>
                  {%$type%}
              </select>
          </td>
        </tr>
        <tr>
          <td class="firtd"> 排序:</td>
          <td><input type="text" name="sort_order" value="{%$edit.sort_order%}"></td>
        </tr>
        <tr>
          <td class="firtd"> 关键字:</td>
          <td>
            <input type="text" name="keywords" value="{%$edit.keywords%}">
          </td>
        </tr>
        <tr>
          <td class="firtd"> 描述:</td>
          <td><textarea name="cat_desc" style="min-height:120px; max-height:120px;">{%$edit.cat_desc%}</textarea></td>
        </tr>
        <tr>
          <td class="style1">&nbsp;</td>
          <td>
              <input type="hidden" name="act" value="edit">
              <input type="hidden" name="cat_id" value="{%$edit.cat_id%}<">
              <a href="JavaScript:void(0);" class="btn" onclick="reset()"><span>重置</span></a>
              <a href="JavaScript:void(0);" class="btn" onclick="$('#tj').click()"><span>确认提交</span></a>
          </td>
        </tr>
      </tbody>
    </table>
    <input type="reset" id="cz" style="display: none;">
    <input type="submit" id="tj" style="display:none;";>
  </form>
</div>
</body>

<script>
// 重置方法
function reset(){
	$('input').val('');
	$('textarea').text('');
	$('select').val('');
}
//选择分类调用方法
function get_news_type(obj,id){
  $.post("news_type.php",{act:'type_judge',cat_id:id},function(data){
        if(data==2){
            alert("系统保留分类,不允许添加子分类");
             $("#option").eq(0).attr("selected","selected");  
        }
  })
}
</script>
</html>